<#if (skuPropertyValue?size>0)>
<form class="addel" method="post" action="/skuPropertyValue/add/${skuProperty.id}">
    <h2> ${skuProperty.name}</h2>
    <#--<input type="hidden" name="id" value="${skuProperty.id}">-->
    <#list skuPropertyValue as data>
        <div class="form-group addel-target">
            <input type="hidden" name="id" value="${data.id}">
            <div class="input-group">
                <input type="text" id="contact" name="value" value="${data.value}" class="form-control">
            <span class="input-group-btn">
                <button type="button" class="btn btn-danger addel-delete">
                    <i class="fa fa-remove"> </i>
                </button>
            </span>
            </div>
        </div>
    </#list>
    <div class="form-group col-sm-4">
        <button type="button" class="btn btn-success btn-block addel-add">
            <i class="fa fa-plus"></i>
        </button>
    </div>
</form>

<#else >
<form class="addel"
      data-addel-hide="true"
      data-addel-add="3"
      data-addel-animation-duration="1000"
      method="post" action="/skuPropertyValue/add/${skuProperty.id}">
    <h2> ${skuProperty.name}</h2>
    <div class="form-group" data-addel-target>
        <div class="input-group">
            <input type="hidden" name="id" value="" >
            <input type="text" id="contact" name="value" value="" class="form-control">
            <span class="input-group-btn">
                <button type="button" class="btn btn-danger" data-addel-delete>
                    <i class="fa fa-remove"></i>
                </button>
            </span>
        </div>
    </div>
    <div class="row">
        <div class="form-group col-sm-4">
            <button type="button" class="btn btn-success btn-block" data-addel-add="1">
                <i class="fa fa-plus"></i>
            </button>
        </div>
    </div>
</form>
</#if>

<script>
    $(document).ready(function () {
        $('.addel').addel({
            events: {
                added: function (event) {

                }
            }
        }).on('addel:delete', function (event) {
            var skuPropertyValueId = event.target.find(':input').val();
            if (skuPropertyValueId) {
                $.get("/skuPropertyValue/deleteSkuValue/" + skuPropertyValueId,function(data){
                    if(data.success){
                        $.messager.popup(data.msg);
                    }
                });
            }
        })
    })

</script>
